import request from '@/utils/request'

export function getApiTree(params) {
    return request({
        url: '/api/apiTree',
        method: 'get',
        params,
    })
}

export function lazyTree(params) {
    return request({
        url: '/api/lazyTree',
        method: 'get',
        params,
    })
}


export function fetchAllNodes(params) {
    return request({
        url: '/api/fetchAllNodes',
        method: 'get',
        params,
    })
}

export function createTreeNode(data) {
    return request({
        url: '/api/createTreeNode',
        method: 'post',
        data,
    })
}

export function renameTreeNode(data) {
    return request({
        url: '/api/renameTreeNode',
        method: 'put',
        data,
    })
}

export function deleteTreeNode(data) {
    return request({
        url: '/api/deleteTreeNode',
        method: 'delete',
        data,
    })
}

export function moveTreeNode(data) {
    return request({
        url: '/api/moveTreeNode',
        method: 'put',
        data,
    })
}


export function copyTreeNode(data) {
    return request({
        url: '/api/copyTreeNode',
        method: 'post',
        data,
    })
}

export function swapTreeNode(data) {
    return request({
        url: '/api/swapTreeNode',
        method: 'put',
        data,
    })
}

export function unitedTreeNode(data) {
    return request({
        url: '/api/unitedTreeNode',
        method: 'post',
        data,
    })
}

export function createInstance(data) {
    return request({
        url: '/api/instance',
        method: 'post',
        data,
    })
}

export function deleteInstance(data) {
    return request({
        url: '/api/instance',
        method: 'delete',
        data,
    })
}

export function fetchInstancePage(params) {
    return request({
        url: '/api/instancePage',
        method: 'get',
        params,
    })
}

export function updateInstance(data) {
    return request({
        url: '/api/instance',
        method: 'put',
        data,
    })
}

export function syncSwagger(data) {
    return request({
        url: '/api/sync',
        method: 'post',
        data,
    })
}
